function entityTakeDamage(ent, inflictor, attacker, amount, dmginfo)
	if(ent:GetClass() == "gb_core") then return end
	
	local dt = dmginfo:GetDamageType();

	if(dt == DMG_GENERIC) then
		cPrint = "DMG_GENERIC";
	elseif(dt == DMG_CRUSH) then
		cPrint = "DMG_CRUSH";
		amount = amount * 1;
	elseif(dt == DMG_BLAST) then
		cPrint = "DMG_BLAST";
	elseif(dt == DMG_DIRECT) then
		cPrint = "DMG_DIRECT";
	elseif(dt == DMG_BURN) then
		cPrint = "DMG_BURN";
	end
	
	local mass = ent:GetPhysicsObject():GetMass();
	
	if(not ent.SPD_Data) then ent.SPD_Data = {} end
	
	if(not ent.SPD_Data.Health) then ent.SPD_Data.Health = mass; end
	
	ent.SPD_Data.Health = ent.SPD_Data.Health - amount * 0.25;
	local healthPercentage = ent.SPD_Data.Health / mass;
	ent:SetColor(255, 255 * healthPercentage, 255 * healthPercentage, 255);
	
	if(ent.SPD_Data.Health <= mass * 0.5) then constraint.RemoveAll(ent); end
	if(ent.SPD_Data.Health <= 0) then ent:Remove(); end
end

hook.Add("EntityTakeDamage", "entityTakeDamage", entityTakeDamage);